<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // 1. 箭头函数不会改变this指向，
      var adder = {
        base: 1,

        add: function (a) {
          var f = (v) => v + this.base;
          return f(a);
        },

        addThruCall: function (a) {
          console.log(this);
          var b = {
            base: 2,
          };

          var f = (v) => v + this.base;
          var f = function (v) {
            return v + this.base;
          };

          return f.call(b, a);
        },
      };

      console.log(adder.add(1)); // 输出 2
      console.log(adder.addThruCall(1)); // 仍然输出 2
    </script>
  </body>
</html>
